package com.ctsi.system.vo;

import com.ctsi.core.web.tree.INode;
import com.fasterxml.jackson.annotation.JsonInclude;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

import java.util.ArrayList;
import java.util.List;

/**
 * 字典树响应对象
 *
 * @author wang xiao xiang
 */
@Data
@JsonInclude(JsonInclude.Include.NON_NULL)
public class DictTreeResVO implements INode {

	/**
	 * 主键
	 */
	private Long id;
	/**
	 * 父主键
	 */
	@ApiModelProperty(value = "父主键")
	private Long parentId;
	/**
	 * 字典码
	 */
	@ApiModelProperty(value = "字典码")
	private String code;
	/**
	 * 字典值
	 */
	@ApiModelProperty(value = "字典值")
	private String dictKey;
	/**
	 * 字典名称
	 */
	@ApiModelProperty(value = "字典名称")
	private String dictValue;
	/**
	 * 排序
	 */
	@ApiModelProperty(value = "排序")
	private Integer sort;

	/**
	 * 子孙节点
	 */
	@JsonInclude(JsonInclude.Include.NON_EMPTY)
	private List<INode> children;

	/**
	 * 是否有子孙节点
	 */
	@JsonInclude(JsonInclude.Include.NON_EMPTY)
	private Boolean hasChildren;

	@Override
	public List<INode> getChildren() {
		if (this.children == null) {
			this.children = new ArrayList<>();
		}
		return this.children;

	}
}
